package com.wydstation.power.collection;

public class UnitItem {
    private String deviceId;
    private int unidId;//传感器id
    private int startAddress;//开始点位
    private int count;//点位的最终位置
    private int limit;//每次的限制点数
    private int type;
    private int end;


    public String getDeviceId() {
        return deviceId;
    }

    public void setDeviceId(String deviceId) {
        this.deviceId = deviceId;
    }

    public int getStart() {
        return startAddress;
    }

    public int getEnd() {
        if (end == 0) {
            return end = limit;
        }
        this.startAddress = end;
        this.end += limit;
        if (this.end > this.count) {
            this.end = count;
        }
        return this.end;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public int getUnidId() {
        return unidId;
    }

    public void setUnidId(int unidId) {
        this.unidId = unidId;
    }

    public int getStartAddress() {
        return startAddress;
    }

    public void setStartAddress(int startAddress) {
        this.startAddress = startAddress;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    public int getLimit() {
        if (end >= count) {
            return end;
        }
        return limit;
    }

    public void setLimit(int limit) {
        this.limit = limit;
    }

    public void clean(){
        this.end=0;
        this.startAddress=0;
    }
}
